package br.ufc.engsoft.util;

import org.json.JSONObject;

import android.content.Context;
import android.os.AsyncTask;

public class Post {

	private String url;

	private String title;
	private String text;

	public Post(String title, String text) {
		this.title = title;
		this.text = text;
	}

	public Post(String url) {
		this.url = url;
	}

	public void getPost() {
		String json = JSONFunctions.getJSONfromURL(getUrl());
		String title = "";
		String text = "";
		try {
			JSONObject json1 = new JSONObject(json);
			title = (String) json1.getJSONObject("parse").getString("title");
			text = (String) json1.getJSONObject("parse").getJSONObject("text")
					.getString("*");
			// Setando os valores que foram buscados
			this.title = title;
			this.text = text;

		} catch (Exception e) {
			System.out.println("Erro na hora de parsear:   "
					+ e.getStackTrace());
		}

	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

}
